package com.example.myblog.interceptor;


import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * Created by asus on 2020/5/28 20:40
 *
 * addPathPatterns 拦截路径
 *
 * excludePathPatterns 排除拦截路径
 */
@Configuration
public class WebConfig implements WebMvcConfigurer {

        @Override
        public void addInterceptors(InterceptorRegistry registry) {
            registry.addInterceptor(new LoginInterceptor())
                    .addPathPatterns("/admin/**")
                .excludePathPatterns("/admin","/admin/login");
    }
}
